package org.example.T;

import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
//注解这个类是接受ioc容器管理的bean
@Service
public class Father extends Person {
    private Child child;
//提供一种方式找到儿子
    public void setChild(Child child) {
        this.child = child;
    }
    public Father(){
        System.out.println("调用构造函数Father");
    }
    //买酱油
    public void bySalt(){
        System.out.println(this.getName()+"不想动，让儿子去买");
        child.bySalt();
    }
}
